package com.terrier.utils
{
    import flash.utils.getTimer;

    /**
     * 计时器
     * @author Jarvis.weng
     */
    public class WxTicker
    {
        private var _lastTick:int;

        public function WxTicker()
        {
            reset();
        }

        /**
         * 重置计时器
         */
        public function reset():void
        {
            _lastTick = getTimer();
        }

        /**
         * 获得上一次调用该方法后经过的时间(毫秒)
         * @return
         */
        public function getTick():int
        {
            var oldTick:int = _lastTick;
            _lastTick = getTimer();
            return _lastTick - oldTick;
        }
    }
}
